﻿using UnityEngine;
using System.Collections.Generic;

namespace TTGameEngine {

//整体加载资源块时，会需要确认加载了哪些资源模块。
public delegate void Func_ResLoadStart(string name);

//资源路径分类
public enum PrefabPathType {
    Enemy_Prefab_Path,
    Role_Prefab_Path,
    Bullet_Prefab_Path,
    Effect_Prefab_Path,
}

/*
 * 负责【整体加载】游戏对象的【资源块】。
 *
 * GameObjectLoader的Func_ResLoadOK(name, object) 中 name不仅仅指资源路径，也可能是资源模块名。
 *
 *
 */
public class GameObjectLoader : ObjectLoader {
    static GameObjectLoader instance = null;

    public static GameObjectLoader Ins {
        get {
            if(instance == null) {
                instance = GameLauncher.Self.AddLogicScript<GameObjectLoader>();
            }
            return instance;
        }
    }

    public string GetPrefabRootPath(PrefabPathType prefabPathType) {
        string rootPath = "";
        switch(prefabPathType) {
            case PrefabPathType.Enemy_Prefab_Path:
                rootPath = GameConstant.PrefabPath_Enemy;
                break;
            case PrefabPathType.Role_Prefab_Path:
                rootPath = GameConstant.PrefabPath_Role;
                break;
            case PrefabPathType.Bullet_Prefab_Path:
                rootPath = GameConstant.PrefabPath_Bullet;
                break;
            case PrefabPathType.Effect_Prefab_Path:
                rootPath = GameConstant.PrefabPath_Effect;
                break;
        }
        return rootPath;
    }

    public GameObject GetPrefabObj(string prefabName, PrefabPathType prefabPathType) {
        return GameObjectLoader.Ins.GetPrefabObj(GetPrefabRootPath(prefabPathType) + prefabName) as GameObject;
    }
    // =============== 加载资源块 ===============




}
}